package com.thread.learn.thread2;

import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.FutureTask;

public class Demo4 implements Callable<Integer>{
	
	public static void main(String[] args) throws InterruptedException, ExecutionException {
		Demo4 d=new Demo4();
		
		FutureTask<Integer> taks=new FutureTask<Integer>(d);
		
		Thread t=new Thread(taks);
		t.start();
		
		Integer integer = taks.get();
		System.out.println(integer);
		
	}

	public Integer call() throws Exception {
		System.out.println("正在进行紧张的计算");
		Thread.sleep(3000);
		return 1;
	}
	
	
}
